package com.wedo.mall.widget;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.bigkoo.convenientbanner.holder.Holder;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.wedo.mall.R;
import com.wedo.mall.util.WUrl;

/**
 * Created by e on 2017/7/9.
 */

public class GoodsBanner implements Holder<String> {

    private ImageView imageView;


    @Override
    public View createView(Context context) {
        imageView = new ImageView(context);
//        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
        imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
        return imageView;
    }

    @Override
    public void UpdateUI(Context context, int i, String img) {
        String url = WUrl.url(img);
        Glide.with(context).load(url).error(R.drawable.place_holder_goods).placeholder(R.drawable.place_holder_goods).diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView);
    }
}
